$(function(){
	var flag = true;
	$("[name='name']").blur(function(){
		if ($(this).val().trim() != ""){ 
			$.post("DetectionRoomTypeNameServlet",{name:$(this).val()},function(result){
				flag = result.color == "red";
				if (flag) {
					$(".msg").css("color","green").html("查找到该信息");
				} else {
					$(".msg").css("color","red").html("未找到该信息");
				}
				$(".msg").css({"fontSize":"18px","fontWeight":"700"});
			},"JSON");
		} else {
			$(".msg").css("color","red").html("不能输入为空");
			flag = false;
		}
	});
	
	$("input:submit").click(function(){
		flag = flag && $("[name='name']").val().trim() != "";
		$("form").submit(flag);
	});
	
});